ubuntuversion=ubuntu1604
cudaversion=8.0.61

#sudo apt-get install -y linux-image-extra-`uname -r` linux-headers-`uname -r` linux-image-`uname -r`
wget http://developer.download.nvidia.com/compute/cuda/repos/"$ubuntuversion"/x86_64/cuda-repo-"$ubuntuversion"_"$cudaversion"-1_amd64.deb
wget -qO - http://developer.download.nvidia.com/compute/cuda/repos/"$ubuntuversion"/x86_64/7fa2af80.pub | sudo apt-key add -
sudo dpkg -i  cuda-repo-"$ubuntuversion"_"$cudaversion"-1_amd64.deb
sudo apt-get -y update
#sudo apt-get -y upgrade
sudo apt-get install -y cuda-8-0
sudo sh -c "sudo echo '/usr/local/cuda/lib64' > /etc/ld.so.conf.d/cuda.conf"

tar -zxf cudnn-8.0-linux-x64-v6.0.tgz
sudo cp -P cuda/lib64/* /usr/local/cuda/lib64/
sudo cp cuda/include/* /usr/local/cuda/include/
rm -rf ./cuda

sudo ldconfig

#gedit ~/.bashrc
#//Add following 2 lines at the end and save
#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
#export CUDA_HOME=/usr/local/cuda

echo "export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64\"" >> ~/.bashrc
echo "export CUDA_HOME=/usr/local/cuda" >> ~/.bashrc

source ~/.bashrc


